/**
 * 
 */
package com.giventime.stormcoming.renderers;

import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.giventime.stormcoming.units.StormUnit;

/**
 * @author ANDROUTA
 *
 */
public class StormUnitRenderer extends Renderer<StormUnit> {

	private BitmapFont font = new BitmapFont();
	
	/**
	 * 
	 */
	@Override
	public void render(SpriteBatch spriteBatch, StormUnit renderable) {
		spriteBatch.draw(renderable.getCellContentType().getTexture(), 
				(renderable.getCellContentType().getXOffset() - renderable.getCellContentType().getSize()) + (renderable.getHolderCell().getDungeonCoordinates().getColumn() * 40), 
				(renderable.getCellContentType().getYOffset() - renderable.getCellContentType().getSize()) + (renderable.getHolderCell().getDungeonCoordinates().getRow() * 40));
		displayLevel(spriteBatch, renderable);
		
	}
	
	/**
	 * 
	 * @param batch
	 */
	private void displayLevel(SpriteBatch spriteBatch, StormUnit renderable) {
		font.setScale(0.8f, 0.8f);
		font.draw(spriteBatch, String.valueOf(renderable.getLvl()), 
				35 + (renderable.getHolderCell().getDungeonCoordinates().getColumn() * 40),
				35 + (renderable.getHolderCell().getDungeonCoordinates().getRow() * 40));
	}

}
